﻿@using Wabo.Web.Areas.Manager.ViewModels.User
@model UserListViewModel

@{
    ViewBag.Title = Messages.HeadingUserList;
}
<div class="page-header">
    <h1>@Messages.HeadingUserList 
    @if (Model.CanWrite)
    {
        <a class="btn btn-primary pull-right" href="@Url.Action("Create","User")">
            <i class=" icon-plus-sign icon-white"></i>@Messages.ButtonCreate
        </a>    
    }     
        </h1> 
</div>

<table class="table">
    <thead>
        <tr>
            <th>@MetadataMessages.DISP_Username</th>
            <th>@MetadataMessages.DISP_FirstName</th>
            <th>@MetadataMessages.DISP_LastName</th>
            <th></th>
        </tr>        
    </thead>
    @foreach (UserListItem item in Model.Users)
    {
        <tr>
            <td>
                @if (Model.CanWrite){
                    @Html.ActionLink(item.User.username,"Edit","User",new{item.User.id},null)
                }
                else{
                    @item.User.username
                }
                @if(item.User.locked)
                {
                    <span class="icon-flag" title="@Messages.AccountIsLocked"></span>
                }
            </td>
            <td>
                @item.User.name
            </td>
            <td>
                @item.User.last_name
            </td>
            <td>
                @if (Model.CanDelete)
                {
                    <a class="btn btn-mini btn-danger pull-right" href="@Url.Action("Delete","User",new{item.User.id})" ><i class=" icon-remove icon-white"></i>@Messages.ButtonDelete</a>            
                }
            </td>

        </tr>
    }
</table>